{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Calculate descriptors and draw heatmap\n",
    "This tutorial shows how to calculate descriptors using `xenonpy.descriptor` system. We will calculate compositional and structural descriptors using `xenonpy.descriptor.Compositions` and `xenonpy.descriptor.Structures` respectively.\n",
    "\n",
    "We need some sample data to execute these calculations. If you don't have it, please see https://github.com/yoshida-lab/XenonPy/blob/master/samples/build_sample_data.ipynb."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### useful tools"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%run tools.ipynb"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### load sample data "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>band_gap</th>\n",
       "      <th>composition</th>\n",
       "      <th>density</th>\n",
       "      <th>e_above_hull</th>\n",
       "      <th>efermi</th>\n",
       "      <th>elements</th>\n",
       "      <th>final_energy_per_atom</th>\n",
       "      <th>formation_energy_per_atom</th>\n",
       "      <th>pretty_formula</th>\n",
       "      <th>structure</th>\n",
       "      <th>volume</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>mp-1008807</th>\n",
       "      <td>0.0000</td>\n",
       "      <td>{'Rb': 1.0, 'Cu': 1.0, 'O': 1.0}</td>\n",
       "      <td>4.784634</td>\n",
       "      <td>0.996372</td>\n",
       "      <td>1.100617</td>\n",
       "      <td>[Cu, O, Rb]</td>\n",
       "      <td>-3.302762</td>\n",
       "      <td>-0.186408</td>\n",
       "      <td>RbCuO</td>\n",
       "      <td>[[-3.05935361 -3.05935361 -3.05935361] Rb, [0....</td>\n",
       "      <td>57.268924</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1009640</th>\n",
       "      <td>0.0000</td>\n",
       "      <td>{'Pr': 1.0, 'N': 1.0}</td>\n",
       "      <td>8.145777</td>\n",
       "      <td>0.759393</td>\n",
       "      <td>5.213442</td>\n",
       "      <td>[N, Pr]</td>\n",
       "      <td>-7.082624</td>\n",
       "      <td>-0.714336</td>\n",
       "      <td>PrN</td>\n",
       "      <td>[[0. 0. 0.] Pr, [1.57925232 1.57925232 1.58276...</td>\n",
       "      <td>31.579717</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1016825</th>\n",
       "      <td>0.7745</td>\n",
       "      <td>{'Hf': 1.0, 'Mg': 1.0, 'O': 3.0}</td>\n",
       "      <td>6.165888</td>\n",
       "      <td>0.589550</td>\n",
       "      <td>2.424570</td>\n",
       "      <td>[Hf, Mg, O]</td>\n",
       "      <td>-7.911723</td>\n",
       "      <td>-3.060060</td>\n",
       "      <td>HfMgO3</td>\n",
       "      <td>[[2.03622802 2.03622802 2.03622802] Hf, [0. 0....</td>\n",
       "      <td>67.541269</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1017582</th>\n",
       "      <td>0.0000</td>\n",
       "      <td>{'La': 1.0, 'Pt': 3.0, 'C': 1.0}</td>\n",
       "      <td>14.284261</td>\n",
       "      <td>0.523635</td>\n",
       "      <td>8.160496</td>\n",
       "      <td>[C, La, Pt]</td>\n",
       "      <td>-6.684482</td>\n",
       "      <td>-0.215712</td>\n",
       "      <td>LaPt3C</td>\n",
       "      <td>[[0. 0. 0.] La, [0.         2.20339716 2.20339...</td>\n",
       "      <td>85.579224</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1021511</th>\n",
       "      <td>1.5186</td>\n",
       "      <td>{'Cd': 1.0, 'S': 1.0}</td>\n",
       "      <td>2.582691</td>\n",
       "      <td>0.252860</td>\n",
       "      <td>-2.121180</td>\n",
       "      <td>[Cd, S]</td>\n",
       "      <td>-2.909105</td>\n",
       "      <td>-0.719529</td>\n",
       "      <td>CdS</td>\n",
       "      <td>[[2.12807605 1.22864286 2.67990375] Cd, [-2.46...</td>\n",
       "      <td>92.890725</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            band_gap                       composition    density  \\\n",
       "mp-1008807    0.0000  {'Rb': 1.0, 'Cu': 1.0, 'O': 1.0}   4.784634   \n",
       "mp-1009640    0.0000             {'Pr': 1.0, 'N': 1.0}   8.145777   \n",
       "mp-1016825    0.7745  {'Hf': 1.0, 'Mg': 1.0, 'O': 3.0}   6.165888   \n",
       "mp-1017582    0.0000  {'La': 1.0, 'Pt': 3.0, 'C': 1.0}  14.284261   \n",
       "mp-1021511    1.5186             {'Cd': 1.0, 'S': 1.0}   2.582691   \n",
       "\n",
       "            e_above_hull    efermi     elements  final_energy_per_atom  \\\n",
       "mp-1008807      0.996372  1.100617  [Cu, O, Rb]              -3.302762   \n",
       "mp-1009640      0.759393  5.213442      [N, Pr]              -7.082624   \n",
       "mp-1016825      0.589550  2.424570  [Hf, Mg, O]              -7.911723   \n",
       "mp-1017582      0.523635  8.160496  [C, La, Pt]              -6.684482   \n",
       "mp-1021511      0.252860 -2.121180      [Cd, S]              -2.909105   \n",
       "\n",
       "            formation_energy_per_atom pretty_formula  \\\n",
       "mp-1008807                  -0.186408          RbCuO   \n",
       "mp-1009640                  -0.714336            PrN   \n",
       "mp-1016825                  -3.060060         HfMgO3   \n",
       "mp-1017582                  -0.215712         LaPt3C   \n",
       "mp-1021511                  -0.719529            CdS   \n",
       "\n",
       "                                                    structure     volume  \n",
       "mp-1008807  [[-3.05935361 -3.05935361 -3.05935361] Rb, [0....  57.268924  \n",
       "mp-1009640  [[0. 0. 0.] Pr, [1.57925232 1.57925232 1.58276...  31.579717  \n",
       "mp-1016825  [[2.03622802 2.03622802 2.03622802] Hf, [0. 0....  67.541269  \n",
       "mp-1017582  [[0. 0. 0.] La, [0.         2.20339716 2.20339...  85.579224  \n",
       "mp-1021511  [[2.12807605 1.22864286 2.67990375] Cd, [-2.46...  92.890725  "
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Index: 933 entries, mp-1008807 to mvc-4727\n",
      "Data columns (total 11 columns):\n",
      "band_gap                     933 non-null float64\n",
      "composition                  933 non-null object\n",
      "density                      933 non-null float64\n",
      "e_above_hull                 933 non-null float64\n",
      "efermi                       796 non-null float64\n",
      "elements                     933 non-null object\n",
      "final_energy_per_atom        933 non-null float64\n",
      "formation_energy_per_atom    933 non-null float64\n",
      "pretty_formula               933 non-null object\n",
      "structure                    933 non-null object\n",
      "volume                       933 non-null float64\n",
      "dtypes: float64(7), object(4)\n",
      "memory usage: 87.5+ KB\n"
     ]
    }
   ],
   "source": [
    "from xenonpy.datatools import preset\n",
    "\n",
    "samples = preset.mp_samples\n",
    "samples.head()\n",
    "samples.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### calculate descriptors from composition"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Compositions:\n",
       "  |- composition:\n",
       "  |  |- WeightedAvgFeature\n",
       "  |  |- WeightedSumFeature\n",
       "  |  |- WeightedVarFeature\n",
       "  |  |- MaxFeature\n",
       "  |  |- MinFeature"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from xenonpy.descriptor import Compositions\n",
    "\n",
    "cal = Compositions()\n",
    "cal"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Print ``cal`` object will show the structure information.\n",
    "This information tells us ``cal`` has one featurizer group called **composition** with 5 featurizers in it.\n",
    "\n",
    "To use this calculator, users only need to feed a iterable object containing composition information of compounds to the ``cal.transform`` or ``cal.fit_transform`` method of ``cal``.\n",
    "The input type can be ``pymatgen.Structure``, or dicts which have the structure like *{'H': 2, 'O': 1}*.\n",
    "\n",
    "Using our sample data, users will obtain a pandas.DataFrame object containing the calculated descriptors."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ave:atomic_number</th>\n",
       "      <th>ave:atomic_radius</th>\n",
       "      <th>ave:atomic_radius_rahm</th>\n",
       "      <th>ave:atomic_volume</th>\n",
       "      <th>ave:atomic_weight</th>\n",
       "      <th>ave:boiling_point</th>\n",
       "      <th>ave:bulk_modulus</th>\n",
       "      <th>ave:c6_gb</th>\n",
       "      <th>ave:covalent_radius_cordero</th>\n",
       "      <th>ave:covalent_radius_pyykko</th>\n",
       "      <th>...</th>\n",
       "      <th>min:num_s_valence</th>\n",
       "      <th>min:period</th>\n",
       "      <th>min:specific_heat</th>\n",
       "      <th>min:thermal_conductivity</th>\n",
       "      <th>min:vdw_radius</th>\n",
       "      <th>min:vdw_radius_alvarez</th>\n",
       "      <th>min:vdw_radius_mm3</th>\n",
       "      <th>min:vdw_radius_uff</th>\n",
       "      <th>min:sound_velocity</th>\n",
       "      <th>min:Polarizability</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>mp-1008807</th>\n",
       "      <td>24.666667</td>\n",
       "      <td>174.067140</td>\n",
       "      <td>209.333333</td>\n",
       "      <td>25.666667</td>\n",
       "      <td>55.004267</td>\n",
       "      <td>1297.063333</td>\n",
       "      <td>72.868680</td>\n",
       "      <td>1646.90</td>\n",
       "      <td>139.333333</td>\n",
       "      <td>128.333333</td>\n",
       "      <td>...</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.360</td>\n",
       "      <td>0.02658</td>\n",
       "      <td>152.0</td>\n",
       "      <td>150.0</td>\n",
       "      <td>182.0</td>\n",
       "      <td>349.5</td>\n",
       "      <td>317.5</td>\n",
       "      <td>0.802</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1009640</th>\n",
       "      <td>33.000000</td>\n",
       "      <td>137.000000</td>\n",
       "      <td>232.500000</td>\n",
       "      <td>19.050000</td>\n",
       "      <td>77.457330</td>\n",
       "      <td>1931.200000</td>\n",
       "      <td>43.182441</td>\n",
       "      <td>1892.85</td>\n",
       "      <td>137.000000</td>\n",
       "      <td>123.500000</td>\n",
       "      <td>...</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.192</td>\n",
       "      <td>0.02583</td>\n",
       "      <td>155.0</td>\n",
       "      <td>166.0</td>\n",
       "      <td>193.0</td>\n",
       "      <td>360.6</td>\n",
       "      <td>333.6</td>\n",
       "      <td>1.100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1016825</th>\n",
       "      <td>21.600000</td>\n",
       "      <td>153.120852</td>\n",
       "      <td>203.400000</td>\n",
       "      <td>13.920000</td>\n",
       "      <td>50.158400</td>\n",
       "      <td>1420.714000</td>\n",
       "      <td>76.663625</td>\n",
       "      <td>343.82</td>\n",
       "      <td>102.800000</td>\n",
       "      <td>96.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.146</td>\n",
       "      <td>0.02658</td>\n",
       "      <td>152.0</td>\n",
       "      <td>150.0</td>\n",
       "      <td>182.0</td>\n",
       "      <td>302.1</td>\n",
       "      <td>317.5</td>\n",
       "      <td>0.802</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1017582</th>\n",
       "      <td>59.400000</td>\n",
       "      <td>139.000000</td>\n",
       "      <td>232.800000</td>\n",
       "      <td>11.020000</td>\n",
       "      <td>147.233694</td>\n",
       "      <td>4226.000000</td>\n",
       "      <td>150.200000</td>\n",
       "      <td>1037.58</td>\n",
       "      <td>137.600000</td>\n",
       "      <td>124.800000</td>\n",
       "      <td>...</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.133</td>\n",
       "      <td>13.00000</td>\n",
       "      <td>170.0</td>\n",
       "      <td>177.0</td>\n",
       "      <td>204.0</td>\n",
       "      <td>275.4</td>\n",
       "      <td>2475.0</td>\n",
       "      <td>1.670</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1021511</th>\n",
       "      <td>32.000000</td>\n",
       "      <td>140.500000</td>\n",
       "      <td>226.000000</td>\n",
       "      <td>14.300000</td>\n",
       "      <td>72.237000</td>\n",
       "      <td>877.912000</td>\n",
       "      <td>24.850000</td>\n",
       "      <td>272.50</td>\n",
       "      <td>124.500000</td>\n",
       "      <td>119.500000</td>\n",
       "      <td>...</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.232</td>\n",
       "      <td>0.20500</td>\n",
       "      <td>180.0</td>\n",
       "      <td>189.0</td>\n",
       "      <td>215.0</td>\n",
       "      <td>284.8</td>\n",
       "      <td>2310.0</td>\n",
       "      <td>2.900</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 290 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            ave:atomic_number  ave:atomic_radius  ave:atomic_radius_rahm  \\\n",
       "mp-1008807          24.666667         174.067140              209.333333   \n",
       "mp-1009640          33.000000         137.000000              232.500000   \n",
       "mp-1016825          21.600000         153.120852              203.400000   \n",
       "mp-1017582          59.400000         139.000000              232.800000   \n",
       "mp-1021511          32.000000         140.500000              226.000000   \n",
       "\n",
       "            ave:atomic_volume  ave:atomic_weight  ave:boiling_point  \\\n",
       "mp-1008807          25.666667          55.004267        1297.063333   \n",
       "mp-1009640          19.050000          77.457330        1931.200000   \n",
       "mp-1016825          13.920000          50.158400        1420.714000   \n",
       "mp-1017582          11.020000         147.233694        4226.000000   \n",
       "mp-1021511          14.300000          72.237000         877.912000   \n",
       "\n",
       "            ave:bulk_modulus  ave:c6_gb  ave:covalent_radius_cordero  \\\n",
       "mp-1008807         72.868680    1646.90                   139.333333   \n",
       "mp-1009640         43.182441    1892.85                   137.000000   \n",
       "mp-1016825         76.663625     343.82                   102.800000   \n",
       "mp-1017582        150.200000    1037.58                   137.600000   \n",
       "mp-1021511         24.850000     272.50                   124.500000   \n",
       "\n",
       "            ave:covalent_radius_pyykko  ...  min:num_s_valence  min:period  \\\n",
       "mp-1008807                  128.333333  ...                1.0         2.0   \n",
       "mp-1009640                  123.500000  ...                2.0         2.0   \n",
       "mp-1016825                   96.000000  ...                2.0         2.0   \n",
       "mp-1017582                  124.800000  ...                1.0         2.0   \n",
       "mp-1021511                  119.500000  ...                2.0         3.0   \n",
       "\n",
       "            min:specific_heat  min:thermal_conductivity  min:vdw_radius  \\\n",
       "mp-1008807              0.360                   0.02658           152.0   \n",
       "mp-1009640              0.192                   0.02583           155.0   \n",
       "mp-1016825              0.146                   0.02658           152.0   \n",
       "mp-1017582              0.133                  13.00000           170.0   \n",
       "mp-1021511              0.232                   0.20500           180.0   \n",
       "\n",
       "            min:vdw_radius_alvarez  min:vdw_radius_mm3  min:vdw_radius_uff  \\\n",
       "mp-1008807                   150.0               182.0               349.5   \n",
       "mp-1009640                   166.0               193.0               360.6   \n",
       "mp-1016825                   150.0               182.0               302.1   \n",
       "mp-1017582                   177.0               204.0               275.4   \n",
       "mp-1021511                   189.0               215.0               284.8   \n",
       "\n",
       "            min:sound_velocity  min:Polarizability  \n",
       "mp-1008807               317.5               0.802  \n",
       "mp-1009640               333.6               1.100  \n",
       "mp-1016825               317.5               0.802  \n",
       "mp-1017582              2475.0               1.670  \n",
       "mp-1021511              2310.0               2.900  \n",
       "\n",
       "[5 rows x 290 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Index: 933 entries, mp-1008807 to mvc-4727\n",
      "Columns: 290 entries, ave:atomic_number to min:Polarizability\n",
      "dtypes: float64(290)\n",
      "memory usage: 2.1+ MB\n"
     ]
    }
   ],
   "source": [
    "descriptor = cal.transform(samples['composition'])\n",
    "descriptor.head(5)\n",
    "descriptor.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If the input is a pandas.DataFrame object, the calculator will first try to read the data columns that have the same name as the featurizer groups.\n",
    "For example, the name of the featurizer group in the example above is **composition**.\n",
    "Therefore, the whole object entry can be fed into the calculator's methods without explicitly extracting the **composition** column in the ``samples``."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ave:atomic_number</th>\n",
       "      <th>ave:atomic_radius</th>\n",
       "      <th>ave:atomic_radius_rahm</th>\n",
       "      <th>ave:atomic_volume</th>\n",
       "      <th>ave:atomic_weight</th>\n",
       "      <th>ave:boiling_point</th>\n",
       "      <th>ave:bulk_modulus</th>\n",
       "      <th>ave:c6_gb</th>\n",
       "      <th>ave:covalent_radius_cordero</th>\n",
       "      <th>ave:covalent_radius_pyykko</th>\n",
       "      <th>...</th>\n",
       "      <th>min:num_s_valence</th>\n",
       "      <th>min:period</th>\n",
       "      <th>min:specific_heat</th>\n",
       "      <th>min:thermal_conductivity</th>\n",
       "      <th>min:vdw_radius</th>\n",
       "      <th>min:vdw_radius_alvarez</th>\n",
       "      <th>min:vdw_radius_mm3</th>\n",
       "      <th>min:vdw_radius_uff</th>\n",
       "      <th>min:sound_velocity</th>\n",
       "      <th>min:Polarizability</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>mp-1008807</th>\n",
       "      <td>24.666667</td>\n",
       "      <td>174.067140</td>\n",
       "      <td>209.333333</td>\n",
       "      <td>25.666667</td>\n",
       "      <td>55.004267</td>\n",
       "      <td>1297.063333</td>\n",
       "      <td>72.868680</td>\n",
       "      <td>1646.90</td>\n",
       "      <td>139.333333</td>\n",
       "      <td>128.333333</td>\n",
       "      <td>...</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.360</td>\n",
       "      <td>0.02658</td>\n",
       "      <td>152.0</td>\n",
       "      <td>150.0</td>\n",
       "      <td>182.0</td>\n",
       "      <td>349.5</td>\n",
       "      <td>317.5</td>\n",
       "      <td>0.802</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1009640</th>\n",
       "      <td>33.000000</td>\n",
       "      <td>137.000000</td>\n",
       "      <td>232.500000</td>\n",
       "      <td>19.050000</td>\n",
       "      <td>77.457330</td>\n",
       "      <td>1931.200000</td>\n",
       "      <td>43.182441</td>\n",
       "      <td>1892.85</td>\n",
       "      <td>137.000000</td>\n",
       "      <td>123.500000</td>\n",
       "      <td>...</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.192</td>\n",
       "      <td>0.02583</td>\n",
       "      <td>155.0</td>\n",
       "      <td>166.0</td>\n",
       "      <td>193.0</td>\n",
       "      <td>360.6</td>\n",
       "      <td>333.6</td>\n",
       "      <td>1.100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1016825</th>\n",
       "      <td>21.600000</td>\n",
       "      <td>153.120852</td>\n",
       "      <td>203.400000</td>\n",
       "      <td>13.920000</td>\n",
       "      <td>50.158400</td>\n",
       "      <td>1420.714000</td>\n",
       "      <td>76.663625</td>\n",
       "      <td>343.82</td>\n",
       "      <td>102.800000</td>\n",
       "      <td>96.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.146</td>\n",
       "      <td>0.02658</td>\n",
       "      <td>152.0</td>\n",
       "      <td>150.0</td>\n",
       "      <td>182.0</td>\n",
       "      <td>302.1</td>\n",
       "      <td>317.5</td>\n",
       "      <td>0.802</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1017582</th>\n",
       "      <td>59.400000</td>\n",
       "      <td>139.000000</td>\n",
       "      <td>232.800000</td>\n",
       "      <td>11.020000</td>\n",
       "      <td>147.233694</td>\n",
       "      <td>4226.000000</td>\n",
       "      <td>150.200000</td>\n",
       "      <td>1037.58</td>\n",
       "      <td>137.600000</td>\n",
       "      <td>124.800000</td>\n",
       "      <td>...</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.133</td>\n",
       "      <td>13.00000</td>\n",
       "      <td>170.0</td>\n",
       "      <td>177.0</td>\n",
       "      <td>204.0</td>\n",
       "      <td>275.4</td>\n",
       "      <td>2475.0</td>\n",
       "      <td>1.670</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1021511</th>\n",
       "      <td>32.000000</td>\n",
       "      <td>140.500000</td>\n",
       "      <td>226.000000</td>\n",
       "      <td>14.300000</td>\n",
       "      <td>72.237000</td>\n",
       "      <td>877.912000</td>\n",
       "      <td>24.850000</td>\n",
       "      <td>272.50</td>\n",
       "      <td>124.500000</td>\n",
       "      <td>119.500000</td>\n",
       "      <td>...</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.232</td>\n",
       "      <td>0.20500</td>\n",
       "      <td>180.0</td>\n",
       "      <td>189.0</td>\n",
       "      <td>215.0</td>\n",
       "      <td>284.8</td>\n",
       "      <td>2310.0</td>\n",
       "      <td>2.900</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 290 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            ave:atomic_number  ave:atomic_radius  ave:atomic_radius_rahm  \\\n",
       "mp-1008807          24.666667         174.067140              209.333333   \n",
       "mp-1009640          33.000000         137.000000              232.500000   \n",
       "mp-1016825          21.600000         153.120852              203.400000   \n",
       "mp-1017582          59.400000         139.000000              232.800000   \n",
       "mp-1021511          32.000000         140.500000              226.000000   \n",
       "\n",
       "            ave:atomic_volume  ave:atomic_weight  ave:boiling_point  \\\n",
       "mp-1008807          25.666667          55.004267        1297.063333   \n",
       "mp-1009640          19.050000          77.457330        1931.200000   \n",
       "mp-1016825          13.920000          50.158400        1420.714000   \n",
       "mp-1017582          11.020000         147.233694        4226.000000   \n",
       "mp-1021511          14.300000          72.237000         877.912000   \n",
       "\n",
       "            ave:bulk_modulus  ave:c6_gb  ave:covalent_radius_cordero  \\\n",
       "mp-1008807         72.868680    1646.90                   139.333333   \n",
       "mp-1009640         43.182441    1892.85                   137.000000   \n",
       "mp-1016825         76.663625     343.82                   102.800000   \n",
       "mp-1017582        150.200000    1037.58                   137.600000   \n",
       "mp-1021511         24.850000     272.50                   124.500000   \n",
       "\n",
       "            ave:covalent_radius_pyykko  ...  min:num_s_valence  min:period  \\\n",
       "mp-1008807                  128.333333  ...                1.0         2.0   \n",
       "mp-1009640                  123.500000  ...                2.0         2.0   \n",
       "mp-1016825                   96.000000  ...                2.0         2.0   \n",
       "mp-1017582                  124.800000  ...                1.0         2.0   \n",
       "mp-1021511                  119.500000  ...                2.0         3.0   \n",
       "\n",
       "            min:specific_heat  min:thermal_conductivity  min:vdw_radius  \\\n",
       "mp-1008807              0.360                   0.02658           152.0   \n",
       "mp-1009640              0.192                   0.02583           155.0   \n",
       "mp-1016825              0.146                   0.02658           152.0   \n",
       "mp-1017582              0.133                  13.00000           170.0   \n",
       "mp-1021511              0.232                   0.20500           180.0   \n",
       "\n",
       "            min:vdw_radius_alvarez  min:vdw_radius_mm3  min:vdw_radius_uff  \\\n",
       "mp-1008807                   150.0               182.0               349.5   \n",
       "mp-1009640                   166.0               193.0               360.6   \n",
       "mp-1016825                   150.0               182.0               302.1   \n",
       "mp-1017582                   177.0               204.0               275.4   \n",
       "mp-1021511                   189.0               215.0               284.8   \n",
       "\n",
       "            min:sound_velocity  min:Polarizability  \n",
       "mp-1008807               317.5               0.802  \n",
       "mp-1009640               333.6               1.100  \n",
       "mp-1016825               317.5               0.802  \n",
       "mp-1017582              2475.0               1.670  \n",
       "mp-1021511              2310.0               2.900  \n",
       "\n",
       "[5 rows x 290 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Index: 933 entries, mp-1008807 to mvc-4727\n",
      "Columns: 290 entries, ave:atomic_number to min:Polarizability\n",
      "dtypes: float64(290)\n",
      "memory usage: 2.1+ MB\n"
     ]
    }
   ],
   "source": [
    "descriptor = cal.transform(samples)\n",
    "descriptor.head(5)\n",
    "descriptor.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Also, users can specify what featurizers will be used in a calculation by feeding a ``featurizers`` parameter to calculator.\n",
    "For example, the following code only calculate **WeightedAvgFeature** and **WeightedSumFeature** descriptors."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ave:atomic_number</th>\n",
       "      <th>ave:atomic_radius</th>\n",
       "      <th>ave:atomic_radius_rahm</th>\n",
       "      <th>ave:atomic_volume</th>\n",
       "      <th>ave:atomic_weight</th>\n",
       "      <th>ave:boiling_point</th>\n",
       "      <th>ave:bulk_modulus</th>\n",
       "      <th>ave:c6_gb</th>\n",
       "      <th>ave:covalent_radius_cordero</th>\n",
       "      <th>ave:covalent_radius_pyykko</th>\n",
       "      <th>...</th>\n",
       "      <th>sum:num_s_valence</th>\n",
       "      <th>sum:period</th>\n",
       "      <th>sum:specific_heat</th>\n",
       "      <th>sum:thermal_conductivity</th>\n",
       "      <th>sum:vdw_radius</th>\n",
       "      <th>sum:vdw_radius_alvarez</th>\n",
       "      <th>sum:vdw_radius_mm3</th>\n",
       "      <th>sum:vdw_radius_uff</th>\n",
       "      <th>sum:sound_velocity</th>\n",
       "      <th>sum:Polarizability</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>mp-1008807</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1009640</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1016825</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1017582</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1021511</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 116 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            ave:atomic_number  ave:atomic_radius  ave:atomic_radius_rahm  \\\n",
       "mp-1008807                NaN                NaN                     NaN   \n",
       "mp-1009640                NaN                NaN                     NaN   \n",
       "mp-1016825                NaN                NaN                     NaN   \n",
       "mp-1017582                NaN                NaN                     NaN   \n",
       "mp-1021511                NaN                NaN                     NaN   \n",
       "\n",
       "            ave:atomic_volume  ave:atomic_weight  ave:boiling_point  \\\n",
       "mp-1008807                NaN                NaN                NaN   \n",
       "mp-1009640                NaN                NaN                NaN   \n",
       "mp-1016825                NaN                NaN                NaN   \n",
       "mp-1017582                NaN                NaN                NaN   \n",
       "mp-1021511                NaN                NaN                NaN   \n",
       "\n",
       "            ave:bulk_modulus  ave:c6_gb  ave:covalent_radius_cordero  \\\n",
       "mp-1008807               NaN        NaN                          NaN   \n",
       "mp-1009640               NaN        NaN                          NaN   \n",
       "mp-1016825               NaN        NaN                          NaN   \n",
       "mp-1017582               NaN        NaN                          NaN   \n",
       "mp-1021511               NaN        NaN                          NaN   \n",
       "\n",
       "            ave:covalent_radius_pyykko  ...  sum:num_s_valence  sum:period  \\\n",
       "mp-1008807                         NaN  ...                NaN         NaN   \n",
       "mp-1009640                         NaN  ...                NaN         NaN   \n",
       "mp-1016825                         NaN  ...                NaN         NaN   \n",
       "mp-1017582                         NaN  ...                NaN         NaN   \n",
       "mp-1021511                         NaN  ...                NaN         NaN   \n",
       "\n",
       "            sum:specific_heat  sum:thermal_conductivity  sum:vdw_radius  \\\n",
       "mp-1008807                NaN                       NaN             NaN   \n",
       "mp-1009640                NaN                       NaN             NaN   \n",
       "mp-1016825                NaN                       NaN             NaN   \n",
       "mp-1017582                NaN                       NaN             NaN   \n",
       "mp-1021511                NaN                       NaN             NaN   \n",
       "\n",
       "            sum:vdw_radius_alvarez  sum:vdw_radius_mm3  sum:vdw_radius_uff  \\\n",
       "mp-1008807                     NaN                 NaN                 NaN   \n",
       "mp-1009640                     NaN                 NaN                 NaN   \n",
       "mp-1016825                     NaN                 NaN                 NaN   \n",
       "mp-1017582                     NaN                 NaN                 NaN   \n",
       "mp-1021511                     NaN                 NaN                 NaN   \n",
       "\n",
       "            sum:sound_velocity  sum:Polarizability  \n",
       "mp-1008807                 NaN                 NaN  \n",
       "mp-1009640                 NaN                 NaN  \n",
       "mp-1016825                 NaN                 NaN  \n",
       "mp-1017582                 NaN                 NaN  \n",
       "mp-1021511                 NaN                 NaN  \n",
       "\n",
       "[5 rows x 116 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Index: 933 entries, mp-1008807 to mvc-4727\n",
      "Columns: 116 entries, ave:atomic_number to sum:Polarizability\n",
      "dtypes: float64(116)\n",
      "memory usage: 852.8+ KB\n"
     ]
    }
   ],
   "source": [
    "descriptor = cal.transform(samples, featurizers=['WeightedAvgFeature', 'WeightedSumFeature'])\n",
    "descriptor.head(5)\n",
    "descriptor.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### calculate structural descriptors from structure\n",
    "\n",
    "Similar to the ``Compositions`` calculator. ``Structures`` calculator accept ``pymatgen.Structure`` objects as its input, and then return calculated result as a pandas.DataFrame.\n",
    "\n",
    "``samples`` also has the structure information. We can use these to calculate structural descriptors."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Structures:\n",
       "  |- structure:\n",
       "  |  |- RadialDistributionFunction\n",
       "  |  |- ObitalFieldMatrix"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from xenonpy.descriptor import Structures\n",
    "\n",
    "cal = Structures()\n",
    "cal"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0.1</th>\n",
       "      <th>0.2</th>\n",
       "      <th>0.30000000000000004</th>\n",
       "      <th>0.4</th>\n",
       "      <th>0.5</th>\n",
       "      <th>0.6000000000000001</th>\n",
       "      <th>0.7000000000000001</th>\n",
       "      <th>0.8</th>\n",
       "      <th>0.9</th>\n",
       "      <th>1.0</th>\n",
       "      <th>...</th>\n",
       "      <th>f14_f5</th>\n",
       "      <th>f14_f6</th>\n",
       "      <th>f14_f7</th>\n",
       "      <th>f14_f8</th>\n",
       "      <th>f14_f9</th>\n",
       "      <th>f14_f10</th>\n",
       "      <th>f14_f11</th>\n",
       "      <th>f14_f12</th>\n",
       "      <th>f14_f13</th>\n",
       "      <th>f14_f14</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>mp-1008807</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1009640</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1016825</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1017582</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.3851</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mp-1021511</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 1224 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            0.1  0.2  0.30000000000000004  0.4  0.5  0.6000000000000001  \\\n",
       "mp-1008807  0.0  0.0                  0.0  0.0  0.0                 0.0   \n",
       "mp-1009640  0.0  0.0                  0.0  0.0  0.0                 0.0   \n",
       "mp-1016825  0.0  0.0                  0.0  0.0  0.0                 0.0   \n",
       "mp-1017582  0.0  0.0                  0.0  0.0  0.0                 0.0   \n",
       "mp-1021511  0.0  0.0                  0.0  0.0  0.0                 0.0   \n",
       "\n",
       "            0.7000000000000001  0.8  0.9  1.0  ...  f14_f5  f14_f6  f14_f7  \\\n",
       "mp-1008807                 0.0  0.0  0.0  0.0  ...     0.0     0.0     0.0   \n",
       "mp-1009640                 0.0  0.0  0.0  0.0  ...     0.0     0.0     0.0   \n",
       "mp-1016825                 0.0  0.0  0.0  0.0  ...     0.0     0.0     0.0   \n",
       "mp-1017582                 0.0  0.0  0.0  0.0  ...     0.0     0.0     0.0   \n",
       "mp-1021511                 0.0  0.0  0.0  0.0  ...     0.0     0.0     0.0   \n",
       "\n",
       "            f14_f8  f14_f9  f14_f10  f14_f11  f14_f12  f14_f13  f14_f14  \n",
       "mp-1008807     0.0     0.0      0.0      0.0      0.0      0.0   0.0000  \n",
       "mp-1009640     0.0     0.0      0.0      0.0      0.0      0.0   0.0000  \n",
       "mp-1016825     0.0     0.0      0.0      0.0      0.0      0.0   0.0000  \n",
       "mp-1017582     0.0     0.0      0.0      0.0      0.0      0.0   0.3851  \n",
       "mp-1021511     0.0     0.0      0.0      0.0      0.0      0.0   0.0000  \n",
       "\n",
       "[5 rows x 1224 columns]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Index: 933 entries, mp-1008807 to mvc-4727\n",
      "Columns: 1224 entries, 0.1 to f14_f14\n",
      "dtypes: float64(1224)\n",
      "memory usage: 8.7+ MB\n"
     ]
    }
   ],
   "source": [
    "descriptor = cal.transform(samples)\n",
    "descriptor.head(5)\n",
    "descriptor.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### the base classes\n",
    "\n",
    "There are still lots of details for descriptor calculator system.\n",
    "Before we fill these documents, you can see https://github.com/yoshida-lab/XenonPy/blob/master/samples/build_your_own_descriptor_calculator.ipynb for imaging."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Base class of rdf: (<class 'xenonpy.descriptor.base.BaseDescriptor'>,)\n",
      "Base class of composition: (<class 'xenonpy.descriptor.base.BaseFeaturizer'>,)\n"
     ]
    }
   ],
   "source": [
    "from xenonpy.descriptor import Compositions, ObitalFieldMatrix\n",
    "\n",
    "print('Base class of rdf:', Compositions.__bases__)\n",
    "print('Base class of composition:', ObitalFieldMatrix.__bases__)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
